<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sj" uri="/struts-jquery-tags"%>
<%@ taglib prefix="sjg" uri="/struts-jquery-grid-tags"%>

<script type="text/javascript">
    var rowId = 0;

    $('.ui-reset , #refresh_ccrdebitGrid').click(function(){
        $("#ccrdebitGrid").jqGrid('setGridParam',{search:false});
        var postData = $("#ccrdebitGrid").jqGrid('getGridParam','postData');
        $.extend(postData,{searchField:"",searchString:"",searchOper:""});
        $.extend(postData,{filters:""});
        $("#ccrdebitGrid").trigger("reloadGrid");
    });

    $.subscribe('searchccrdebitGrid', function(event,data) {
        $("#ccrdebitGrid").jqGrid('searchGrid', {drag:true,closeAfterSearch:true,closeOnEscape:true,sopt:['eq'],caption:"Search C.C.R. Bank Debit Memo"} );
    });
    
    $.subscribe('ccrdebitGridComplete',function(event,data){
        $( "#ccrdebitGrid_search" ).button( "option", "disabled", false );
        $( "#ccrdebitGrid_showhide" ).button( "option", "disabled", false );
    });
    
    $.subscribe('showhideccrdebitGrid', function(event,data) {
        $("#ccrdebitGrid").jqGrid('setColumns',{});
    });

</script>
<div class="gridOptsContainer">
    <sj:submit button="true" cssStyle="font-size:14px;" disabled="true" id="ccrdebitGrid_search" onClickTopics="searchccrdebitGrid" value="Search C.C.R. Bank Debit Memo"/>
    <sj:submit button="true" cssStyle="font-size:14px;" disabled="true" id="ccrdebitGrid_showhide" onClickTopics="showhideccrdebitGrid" value="Show/Hide Columns"/>

</div>
<s:url id="remoteurl" action="grid-ccrdebit"/>

<sjg:grid
    id="ccrdebitGrid"
    caption="Cashmate ccrdebit"
    dataType="json"
    href="%{remoteurl}"
    gridModel="gridModel"
    groupField="['branch']"
    groupColumnShow="[true]"
    groupCollapse="true"
    pagerButtons="true"
    pagerInput="true"
    rowList="10,20,50"
    rowNum="50"
    loadingText="Requesting Data..."
    width="970"
    shrinkToFit="true"
    pager="true"
    hoverrows="true"
    rownumbers="true"
    autoencode="true"
    viewrecords="true"
    navigator="true"
    navigatorAdd="false"
    navigatorDelete="false"
    navigatorEdit="false"
    navigatorSearch="true"
    navigatorView="true"
    onGridCompleteTopics="ccrdebitGridComplete"

    >

    
    <sjg:gridColumn name="bankdebitmemoid"
                    index="bankdebitmemoid"
                    title="Bank Debit Memo id. (Not Editable)"
                    sortable="false"
                    key="true"
                    hidden="true"/>


    <sjg:gridColumn name="particulars"
                    index="particulars"
                    title="Particulars"
                    search="true"
                    sortable="true"
                    searchoptions="{sopt:['eq']}"
                    align="center"
                    />
    
    <sjg:gridColumn name="amount"
                    index="amount"
                    title="Amount"
                    sortable="true"
                    align="center"
                    />
    
    <sjg:gridColumn name="branch"
                    index="branch"
                    title="Branch"
                    search="true"
                    sortable="true"
                    searchoptions="{sopt:['eq']}"
                    align="center"
                    />
    

</sjg:grid>
